package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始");
        try {
            //String line=null;
            //String line="";
            String line = "abc";
            System.out.println(Integer.parseInt(line));
            System.out.println(line.length());
        }catch (NullPointerException e){
            //System.out.println("出现异常并解决");
        }catch (StringIndexOutOfBoundsException e){
            //System.out.println("出现异常并解决");

        //}catch (NullPointerException|StringIndexOutOfBoundsException e){
        //    System.out.println("出现了空指针或字符串下标越界异常");
        }
        catch (Exception e){
            System.out.println("出错");
        }
        System.out.println("程序结束");
    }
}
